#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <assert.h>


int main() {

  printf("process is running...\n");

   //execl("/usr/bin/ls","ls",NULL);


  pid_t id = fork();

  // 我们让子进程执行execl的操作

  if(id == 0) {
    sleep(1);
    execl("/usr/bin/ls","ls",NULL);
    exit(1);
  }

  int status = 0;

  pid_t ret = waitpid(id,&status,0);
  if(ret>0){
    printf("wait success: exit code %d,sig: %d\n",(status>>8)&0xFF,status & 0xF);
  }


   printf("process is done\n");

  return 0;
}

